import React from 'react'
import styles from './index.less'
import { useDispatch, useHistory } from 'dva'
import { E } from '../../../../constants'
import { getLocale } from 'umi';
function Index({ id, item }) {
  const history = useHistory()
  let text1 = ""
  let text2 = ""
  let imgUrl = ""
  if (item?.exhibitName) {// 展品
    text1 = getLocale() == 'zh-CN' ? item?.exhibitName : item?.exhibitNameEn 
    text2 =  getLocale() == 'zh-CN' ?item.model : item.modelEn;
    imgUrl = item?.exhibitProperties && item?.exhibitProperties?.albums?.[0]
  } else {// 展商
    text1 = getLocale() == 'zh-CN' ? item.exhibitorName : item.exhibitorEnName;// exhibitor && exhibitor.name
    text2 =  item?.province
    imgUrl = item?.exhibitorLogo
  }

  return (
    <div className={styles.box} onClick={() => {
      history.push(`/wantbuy/detail/${id}`)
    }}>
      <img src={imgUrl}></img>
      <div className={styles.textBox}>
        <span className={styles.name} >{text1}</span>
        <span className={styles.type}>{text2}</span>
      </div>
    </div>
  )
}

export default Index
